package com.fm.financemanage.utils;

import okhttp3.*;

import java.util.concurrent.TimeUnit;

/**
 * okhttp 初始化工具类
 *
 * @return
 **/
public class OkhttpClientUtils {
    private OkhttpClientUtils() {

    }

    public static OkHttpClient getInstance() {
        return Singleton.INSTANCE.getInstance();
    }

    private enum Singleton {

        // 实例化
        INSTANCE;

        private OkHttpClient okHttpClient;

        Singleton() {
            okHttpClient = new OkHttpClient.Builder()
                    .readTimeout(200, TimeUnit.SECONDS)
                    .connectTimeout(200, TimeUnit.SECONDS).build();
        }

        public OkHttpClient getInstance() {
            return okHttpClient;
        }

    }




}
